<?php
declare (strict_types=1);

namespace app\admin\controller;

use app\admin\model\GlobalConfig;

class Base extends \app\BaseController
{
    /**
     * 数据库配置
     * @var array
     */
    protected $global_config;

    /**
     * 初始化
     */
    public function initialize()
    {
        global $globalConfig;
        $globalConfig = $this->global_config = GlobalConfig::getAllConfig();
        $this->crossDomain();
    }

    //跨域处理
    protected function crossDomain()
    {
        header('content-type:text/html;charset=utf-8');
        header('Access-Control-Allow-Origin: *');
        header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept,timestamp");
        header('Access-Control-Allow-Methods: GET, POST, PUT');
    }
}
